<template>
  <!-- 编辑器 -->
  <edu-editor :key="field" :value.sync="current_value" :toolbar="toolbar" :plugins="plugins" />
</template>

<script>
import EduEditor from '@public/form/editor';
export default {
  components: {
    EduEditor
  },
  props: {
    field: {
      type: String,
      required: true
    },
    value: {
      type: String,
      default: ''
    }
  },
  data() {
    return {
      current_value: this.value,
      plugins: 'searchreplace code insertdatetime wordcount',
      toolbar: 'undo redo restoredraft | cut copy paste pastetext |fontsizeselect forecolor backcolor bold italic underline strikethrough'
    };
  },
  watch: {
    current_value(value) {
      this.$emit('update:value', value);
    },
    value: {
      handler(now, old) {
        this.current_value = now;
      }
    }
  }
};
</script>

<style></style>
